package de.hpi.generator.config;



/**
 * inclusion dependency configuration model
 * @author Michael Wolowyk
 */
public class DependencyModel {

    public String dependent;
    public String referenced;
    transient boolean isComposite;
    public DistributionModel distribution = null;

    /**
     * constructor for unary dependencies
     * @param aDependent a dependent part
     * @param aReferenced  a referenced part
     */
    public DependencyModel(String aDependent, String aReferenced) {
        this.dependent = aDependent;
        this.referenced = aReferenced;
    }

    /**
     * constructor for composite dependencies
     * @param aDependent a dependent part
     * @param aReferenced a referenced part
     * @param aDistribution a distribution of the dependency
     */
    public DependencyModel(String aDependent, String aReferenced, DistributionModel aDistribution) {
        this.dependent = aDependent;
        this.referenced = aReferenced;
        this.distribution = aDistribution;
    }

    @Override
    public String toString() {
        String result = String.format("{%s -> %s} \n", this.dependent, this.referenced);
        return result;
    }

    /**
     * sets a model as composite inclusion dependency
     * @param isComposite 
     */
    public void setComposite(boolean isComposite) {
        this.isComposite = isComposite;
    }
    
    
/**
     *  checks if  a model as composite inclusion dependency
     * @return true if a composite, false if an unary
     */
    public boolean isComposite() {
        return isComposite;
    }

    public DistributionModel getDistribution() {
        return distribution;
    }
}
